#include <stdio.h>
#include <math.h>

int search(int n);

int main()
{
    int number;

    scanf("%d", &number);
    printf("count=%d\n", search(number));

    return 0;
}

/* 你的代码将被嵌在这里 */
int search(int n)
{
    int count = 0;
    for (int i = 101; i <= n; i++)
    {
        int k = sqrt(i);
        if (k * k == i)
        {
            int con = i;
            int a, b, c;
            a = con / 100;
            b = con / 10 % 10;
            c = con % 10;
            if (a == b || b == c || a == c)
            {
                count++;
            }
        }
    }
    return count;
};
